import { useI18n } from '/@/hooks/web/useI18n';
import { BasicColumn, BasicTableProps, FormProps } from '/@/components/Table';
import { subSelectList } from '/@/api/m8/order/m8OrderFlowWxOut';

const { t } = useI18n('sys.empUser');

const modalProps = {
  title: t('发料明细选择'),
};

const searchForm: FormProps = {
  baseColProps: { lg: 6, md: 8 },
  labelWidth: 80,
  showResetButton:false,
  schemas: [
    {
      label: 'selIds',
      field: 'selIds',
      component: 'Input',
      show: false,
    },
    {
      label: t('图名'),
      field: 'orderPic.picname',
      component: 'Input',
    },
    {
      label: t('供应商'),
      field: 'wxOut.venCode',
      component: 'Input',
      show: false,
    },
    {
      label: t('红蓝标志'),
      field: 'wxOut.bred',
      component: 'Input',
      show: false,
    },
  ],
};

const tableColumns: BasicColumn[] = [
  {
    title: t('发出日期'),
    dataIndex: 'wxOut.ddate',
    key: 'wxOut.ddate',
    sorter: true,
    width: 120,
    align: 'left',
  },
  {
    title: t('图名'),
    dataIndex: 'orderPic.picname',
    key: 'pic.picname',
    sorter: true,
    width: 200,
    align: 'left',
  },
  {
    title: t('发出数'),
    dataIndex: 'iqty',
    key: 'a.iqty',
    sorter: true,
    width: 80,
  },
  {
    title: t('已收数'),
    dataIndex: 'sumInQty',
    key: 'a.iqty',
    sorter: true,
    width: 80,
    ifShow: true,
  },
  {
    title: t('退回数'),
    dataIndex: 'sumBackQty',
    key: 'a.iqty',
    sorter: true,
    width: 80,
    ifShow: true,
  },
  {
    title: t('厂商'),
    dataIndex: 'wxOut.venCode',
    key: 'wxOut.ven_code',
    sorter: true,
    width: 100,
    dictType: 'm8_ven',
    align: 'left',
  },
];

const tableProps: BasicTableProps = {
  api: subSelectList,
  beforeFetch: (params) => {
    return params;
  },
  columns: tableColumns,
  formConfig: searchForm,
  rowKey: 'id',
};

export default {
  modalProps,
  tableProps,
  itemCode: 'id',
  itemName: 'id',
};
